	function player(that) {





	    $.ajax({
	        type: "post",
	        contentType: "application/json", //必须有
	        url: 'http://igo.vrdete.com/api/video/selectbynumberpay',


	        data: "{'orderinfo':{'userId':'" + localStorage.userId + "','paymentMethod':'Wechat','openid':'" + localStorage.openId + "'},'commodity':[{'videoNumber':'123','buyAmount':'1'}]}",

	        success: function(data) {
	            console.log(data)

	            var str = data.htmlState;
	            var reg = /[^:]*:([^:]*)/;
	            str = str.replace(reg, "$1");
	            console.log(str);
	            if (str == "PendingPay") {
	                onBridgeReady(data, function() {
	                    $.ajax({
	                        type: "post",
	                        contentType: "application/json", //必须有
	                        url: 'http://igo.vrdete.com/api/video/selectbynumberpay',


	                        data: "{'orderinfo':{'userId':'" + localStorage.userId + "','paymentMethod':'Wechat','openid':'" + localStorage.openId + "'},'commodity':[{'videoNumber':'123','buyAmount':'1'}]}",

	                        success: function(data) {

	                            var str = data.htmlState;
	                            var reg = /[^:]*:([^:]*)/;
	                            str = str.replace(reg, "$1");
	                            if (str == "Success") {
	                                $("#my-video")[0].src = data.dataResultList[0].videoSrc;
	                                $(that).remove()
	                                $('.vjs-no-js').remove()
	                            }







	                            console.log(data.dataResultObj);


	                        },
	                        error: function(xhr, type, errorThrown) {
	                            //异常处理；
	                            console.log(type);
	                        }
	                    });
	                });
	            }







	            console.log(data.dataResultObj);


	        },
	        error: function(xhr, type, errorThrown) {
	            //异常处理；
	            console.log(type);
	        }
	    });










	}

	function SubmitOrder() {



	    if (localStorage.openId == undefined) {
	        console.log("请登陆")
	    } else {


	        $.ajax({
	            type: "post",
	            contentType: "application/json", //必须有
	            url: 'http://igo.vrdete.com/api/orderinfo/generateorder',


	            data: "{'orderinfo':{'userId':'" + localStorage.userId + "','orderAddress':'深圳罗湖','paymentMethod':'Wechat','openid':'" + localStorage.openId + "'},'commodity':[{'commodityNumber':'123','buyAmount':'2'},{'commodityNumber':'456','buyAmount':'1'}]}",

	            success: function(data) {
	                console.log(data.dataResultObj);



	                if (typeof WeixinJSBridge == "undefined") {
	                    if (document.addEventListener) {
	                        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	                    } else if (document.attachEvent) {
	                        document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
	                        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	                    }
	                } else {

	                    $("#ordernumber").val(data.dataResultMap.orderNumbenr)

	                    $("#restnumber").val(data.dataResultMap.orderNumbenr)
	                    $("#tko").val(data.dataResultMap.orderNumbenr)

	                    onBridgeReady(data);

	                    /*if(data.htmlState=="Success"){
	                    	
	                    }
	                    else{
	                    	  console.log(
	                    	  "error")
	                    }*/


	                }






	            },
	            error: function(xhr, type, errorThrown) {
	                //异常处理；
	                console.log(type);
	            }
	        });









	    }
	}



	function RSubmitOrder() {



	    if (localStorage.openId == undefined) {
	        console.log("请登陆")
	    } else {


	        var orderNumberdsds = $("#restnumber").val();
	        $.ajax({
	            type: "post",
	            contentType: "application/json", //必须有
	            url: 'http://igo.vrdete.com/api/orderinfo/againneworder',



	            data: "{'userId':'" + localStorage.userId + "','orderNumber':'" + orderNumberdsds + "'}",

	            success: function(data) {
	                console.log(data.dataResultObj);



	                if (typeof WeixinJSBridge == "undefined") {
	                    if (document.addEventListener) {
	                        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	                    } else if (document.attachEvent) {
	                        document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
	                        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	                    }
	                } else {

	                    onBridgeReady(data);



	                }

	            },
	            error: function(xhr, type, errorThrown) {
	                //异常处理；
	                console.log(type);
	            }
	        });









	    }
	}



	function wechatrefund() {
	    var a = $("#tko").val();
	    var b = $("#tkj").val();
	    var c = $("#tkz").val();
	    $.ajax({
	        type: "post",
	        contentType: "application/json", //必须有
	        url: 'http://10.20.5.81:96/api/wechat/pay/video/wechatrefund',
	        data: "{'orderNumber':'" + a + "','refundFee':'" + b + "','paymentAmount':'" + c + "'}",
	        success: function(data) {
	            console.log(data)
	            $("#ordersts").val(data.htmlState)
	        }
	    });

	}









	function onBridgeReady(data, fn) {
	    WeixinJSBridge.invoke(
	        'getBrandWCPayRequest', {
	            "appId": data.dataResultObj.appId, //公众号名称，由商户传入     
	            "timeStamp": data.dataResultObj.timeStamp, //时间戳，自1970年以来的秒数     
	            "nonceStr": data.dataResultObj.nonceStr, //随机串     
	            "package": data.dataResultObj.prepayId,
	            "signType": "MD5", //微信签名方式：     
	            "paySign": data.dataResultObj.paySign //微信签名 
	        },
	        function(res) {
	            if (res.err_msg == "get_brand_wcpay_request:ok") {
	                $("#ordersts").val("支付成功")
	                fn()


	            } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
	                $("#ordersts").val("已取消支付")

	            } // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。 
	        }




	    );
	}